|
|
|
|
|
|
|
Figure 2.9.
Adding the BOOLEAN data type input control. |
|
|
|
|
|
|
|
|
Now run the program. If this is the first time you've run the program, you should see an empty field. Press the Add button to create a new record and then press the Update button to save that record. You see that the first value in the input box is a 0, the default value for BOOLEAN fields. Enter the number 13 in the text box and click the Update button. This forces the data control to save the input field to the data table and update the display. What happened to the 13? It was converted to -1. Any value other than 0, when entered into a BOOLEAN data type field, is converted to -1. |
|
|
|
|
|
|
|
|
Testing the BYTE Data Type |
|
|
|
|
|
|
|
|
Now let's add a label and input control for the BYTE data type field. Instead of picking additional controls from the Toolbox Window and typing in property settings, Visual Basic allows you to copy existing controls. Copying controls saves time, reduces typing errors, and helps to keep the size and shape of the controls on your form consistent. |
|
|
|
|
|
|
|
|
To copy controls, use the mouse pointer, with the left mouse button depressed, to create a dotted-line box around both the label control and the text box control already on your form (in this case, the label Boolean and its text box). When you release the left mouse button, you see that both controls have been marked as selected. Now click Edit | Copy to copy the selected controls to the Clipboard. Use Edit | Paste to copy the controls from the Clipboard back onto your form. |
|
|
|
|
|
|
|
|
At this point, Visual Basic asks you whether you want to create a Control Array. Say yes, both times. You then see the two controls appear at the top left of the form. Use your mouse to position them on the form (see Figure 2.10). |
|
|
|
|
|